﻿using System;
using System.Collections.Generic;
using Lottery.App.Model;
using Lottery.App.DAL;

namespace Lottery.App.BLL
{
    public class LotteryManager
    {
        private const string ID = "id";
        private const string MaxOmit = "MaxOmit";
        private const string CurrentOmit = "LastID";
        private const string Date = "MaxOmitQH";
        private const string TotalCount = "TotalCount";

        public object List(GameMode mode, OrderBy order)
        {
            string orderby = ID;
            bool asc = true;

            switch (order)
            {
                case OrderBy.ID: orderby = ID;
                    break;
                case OrderBy.MaxOmit: orderby = MaxOmit; asc = false;
                    break;
                case OrderBy.CurrentOmit: orderby = CurrentOmit;
                    break;
                case OrderBy.Date: orderby = Date; asc = false;
                    break;
                case OrderBy.TotalCount: orderby = TotalCount;
                    break;
                default:
                    break;
            }

            switch (mode)
            {
                case GameMode.A1: return new A1Dao().Order(orderby, asc);
                case GameMode.A2: return new A2Dao().Order(orderby, asc);
                case GameMode.A3: return new A3Dao().Order(orderby, asc);
                case GameMode.P2: return new P2Dao().Order(orderby, asc);
                case GameMode.P3: return new P3Dao().Order(orderby, asc);
                case GameMode.N2: return new N2Dao().Order(orderby, asc);
                case GameMode.N3: return new N3Dao().Order(orderby, asc);
                case GameMode.N4: return new N4Dao().Order(orderby, asc);
                case GameMode.N5: return new N5Dao().Order(orderby, asc);
                case GameMode.N6: return new N6Dao().Order(orderby, asc);
                case GameMode.N7: return new N7Dao().Order(orderby, asc);
                case GameMode.N8: return new N8Dao().Order(orderby, asc);
                default:
                    break;
            }

            return null;
        }
    }
}
